package com.athena.Objects
{
	import com.junkbyte.console.Cc;
	import flash.geom.Point;
	
	/**
	 * ...
	 * @author chau
	 */
	public class ConfigObject
	{
		private var _tax:Array = [];
		private var _maxPLayer : int;
		private var _hotline : String;
		private var _aution:MiniGameObject = new MiniGameObject("aution");
		private var _lucky:MiniGameObject = new MiniGameObject("lucky");
		private var _lottery:MiniGameObject = new MiniGameObject("lottery");
		private var _dashboard : MiniGameObject = new MiniGameObject("dashboard");
		private var _bgPath : String;
		
		private var _demension : Point = new Point(1024, 600);
		public function ConfigObject() {}
		
		public function set Config(xml:XML):void {
			for each (var item:XML in xml.eachgame) {
				if (parseInt(item.gameid.text()) == Main.getInstance().gameObject.GAMEID) {
					_tax = item.tax.text().split(",");
					_maxPLayer = parseInt(item.maxplayer.text());
					break;
				}
			}
			for each (var link:XML in xml.link.item) {
				if (link.name.text() == _aution.name) {
					_aution.file = link.file.text();
					_aution.estimate = parseInt(link.estimate.text());
					continue;
				}
				if (link.name.text() == _lucky.name) {
					_lucky.file = link.file.text();
					_lucky.estimate = parseInt(link.estimate.text());
					continue;
				}
				if (link.name.text() == _lottery.name) {
					_lottery.file = link.file.text();
					_lottery.estimate = parseInt(link.estimate.text());
					continue;
				}
				if (link.name.text() == _dashboard.name) {
					_dashboard.file = link.file.text();
					_dashboard.estimate = parseInt(link.estimate.text());
					continue;
				}
			}
			_bgPath = xml.bg.text();
			_hotline = xml.hotline.text();
		}
		
		public function get tax():Array {
			return _tax;
		}
		
		public function get aution():MiniGameObject {
			return _aution;
		}
		
		public function get lucky():MiniGameObject {
			return _lucky;
		}
		
		public function get lottery():MiniGameObject {
			return _lottery;
		}
		
		public function get dashboard():MiniGameObject 
		{
			return _dashboard;
		}
		
		public function get bgPath():String 
		{
			return _bgPath;
		}
		
		public function get maxPLayer():int 
		{
			return _maxPLayer;
		}
		
		public function get demension():Point 
		{
			return _demension;
		}
		
		public function set demension(value:Point):void 
		{
			_demension = value;
		}
		
		public function get hotline():String 
		{
			return _hotline;
		}
	}
}